package app

import "yunpan/pool"

// AppContext 应用上下文，管理全局资源
type AppContext struct {
    HashPool  *pool.HashWorkerPool
    DBPool    *pool.DBWorkerPool
    CephPool  *pool.CephWorkerPool
}

// 全局上下文实例
var appCtx *AppContext

// InitContext 初始化应用上下文
func InitContext(hashPool *pool.HashWorkerPool, dbPool *pool.DBWorkerPool, cephPool *pool.CephWorkerPool) {
    appCtx = &AppContext{
        HashPool:  hashPool,
        DBPool:    dbPool,
        CephPool:  cephPool,
    }
}

// GetContext 获取应用上下文
func GetContext() *AppContext {
    return appCtx
}